package name.huzhenbo.java.klass;

import java.util.Collection;

/**
 * Fovor composition over inheriatens.
 */
class InstrumentedSet {
    private Collection set;
    private int count;

    public InstrumentedSet(Collection set) {
        this.set = set;
    }

    public int getCount() {
        return count;
    }

    public boolean add(Object obj) {
        count++;
        return set.add(obj);
    }

    public boolean addAll(Collection c) {
        count += c.size();
        return set.addAll(c);
    }

    public Collection getSet() {
        return set;
    }
}
